/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pkg;

import Utility.ThreadOperationsUtility;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.JspFragment;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import javax.servlet.jsp.PageContext;

/**
 *
 * @author Ruba
 */
public class EditThreadTagHandler extends SimpleTagSupport {
    private  int threadid;
    private  String title;
    /**
     * Called by the container to invoke this tag. 
     * The implementation of this method is provided by the tag library developer,
     * and handles all tag processing, body iteration, etc.
     */
    @Override
    public void doTag() throws JspException {
        xmlMapping.Thread th= new ThreadOperationsUtility().getThread(threadid);
        getJspContext().setAttribute("title",th.getTitle(),PageContext.REQUEST_SCOPE);
        getJspContext().setAttribute("body",th.getBody(),PageContext.REQUEST_SCOPE);
    }

    public void setThreadid(int threadid) {
        this.threadid = threadid;
    }

}
